//
//  UserInfoViewController.m
//  happyHealthyWalk
//
//  Created by newhuidong on 16/2/20.
//  Copyright © 2016年 HuiDong. All rights reserved.
//

#import "UserInfoViewController.h"
#import "Header.h"
#import "UIBarButtonItem+Extensions.h"
@interface UserInfoViewController ()<UITableViewDataSource,UITableViewDelegate>

@property(nonatomic,strong)UITableView * tableView;

@property(nonatomic,strong)NSMutableArray * titleArr;
@property(nonatomic,strong)NSMutableArray * detailArr;


@end

@implementation UserInfoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationController.navigationBar.translucent=NO;
    [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
    self.navigationController.navigationBar.shadowImage=[UIImage new];
    
    
    self.navigationController.navigationBar.barTintColor=GreenColor;
    self.title=@"个人中心";
    self.navigationController.navigationBar.titleTextAttributes=@{NSForegroundColorAttributeName:[UIColor whiteColor]};
    
    self.view.backgroundColor=[UIColor groupTableViewBackgroundColor];
    
    self.tableView=[[UITableView alloc]initWithFrame:CGRectMake(0, 00, ScreenW, ScreenH) style:UITableViewStylePlain];
    
    
    self.tableView.delegate=self;
    self.tableView.dataSource=self;
    
    self.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc]initWithTitle:@"关闭" style:UIBarButtonItemStylePlain target:self action:@selector(fanhui)];
    self.navigationController.navigationBar.tintColor=[UIColor whiteColor];
    
    [self.view addSubview:self.tableView];
    _titleArr=[NSMutableArray arrayWithObjects:@"头像",@"账号",@"用户名",@"姓名",@"性别",@"手机号码", nil];
    _detailArr=[NSMutableArray arrayWithObjects:@"8.jpg",@"1532451",@"尔康",@"福尔康",@"男",@"157614232", nil];

    
}
-(void)fanhui{
    
    [self dismissViewControllerAnimated:YES completion:nil];
    
}


-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    

    NSLog(@"=====%ld",(unsigned long)_titleArr.count);
    
    return _titleArr.count;
    
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString *identifer=@"cell";
    
    UITableViewCell * cell=[tableView dequeueReusableCellWithIdentifier:identifer];
    
    if (cell==nil) {
        
        cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifer];
    }
    

    cell.textLabel.text=self.titleArr[indexPath.row];
   
    cell.detailTextLabel.text=self.detailArr[indexPath.row];
    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    if (indexPath.row==0) {
        
        UIImageView * imageView=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"7.jpg"]];
        imageView.frame=CGRectMake(230, 5, 60, 60);
        
        [cell.contentView addSubview:imageView];
        imageView.layer.cornerRadius=30;
        imageView.layer.masksToBounds=YES;
        
        
    }
    
    return cell;
    
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row==0) {
        return 80;
    }else{
        
        return 44;
        
    }
    
}
-(void)viewWillAppear:(BOOL)animated{
    

}
@end
